package com.example.aidl;

import android.os.Parcel;
import android.os.Parcelable;

public class IBook implements Parcelable {
    int price;
    String name;

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public IBook(int price, String name) {
        this.price = price;
        this.name = name;
    }

    protected IBook(Parcel in) {
        price = in.readInt();
        name = in.readString();
    }


    public static final Creator<IBook> CREATOR = new Creator<IBook>() {
        @Override
        public IBook createFromParcel(Parcel in) {
            return new IBook(in);
        }

        @Override
        public IBook[] newArray(int size) {
            return new IBook[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(price);
        dest.writeString(name);
    }


    public void readFromParcel(Parcel in){
        name=in.readString();
        price=in.readInt();
    }
}
